<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>非变异操作</title>
</head>
<body>

</body>
<script>
    var employees = [
        {
            id:1,
            name:'Mat',
            gender:'male'
        },  {
            id:2,
            name:'Mary',
            gender:'female'
        },
        {
             id:3,
             name:'Tea',
             gender:'female'
        }
    ]


    /**
     * 1. 查询
     *     Q1: 是否可以模拟写出 filter的内部代码
     * */

   var list =    employees.filter(function (emp) {
          return emp.gender=='female'; // true/false
      })

    var current = employees.find(function (emp) {
         return emp.id == 3;
    })


  /**
   *   数组合并
   *        var arr1=[1,3];
   *        var arr2=[2,4];
   *        var arr3 =[1,3,2,4];
   * */
</script>
</html>